package com.treasure.mall.biz.service.core.marketing;

import com.treasure.mall.biz.base.SearchableCrudService;
import com.treasure.mall.biz.entity.marketing.RedPacketGrabLogPO;
import com.treasure.mall.biz.entity.marketing.RedPacketPO;
import com.treasure.mall.biz.entity.user.UserPO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/8/1
 */
public interface RedPacketService extends SearchableCrudService<RedPacketPO, Long> {
    RedPacketPO currentRedPacket(Long merchantId);

    void start(Long id);

    void enabledToggle(Long id);

    RedPacketGrabLogPO grab(Long id, UserPO userPO);

    List<RedPacketGrabLogPO> getGrabLogs(Long redPacketId);

    boolean userGrabbed(Long redPacketId, Long userId);

    /**
     * 回收红包
     *
     * @param redPacketId
     */
    @Transactional
    void recycle(Long redPacketId);
}
